import 'package:flutter/services.dart';

// 手机震动
class JJShock {
  // 轻触
  static light() {
    HapticFeedback.lightImpact();
  }

  // 中等
  static medium() {
    HapticFeedback.mediumImpact();
  }

  // 重等
  static heavy() {
    HapticFeedback.heavyImpact();
  }

  // 时间长一点
  static vibrate() {
    HapticFeedback.vibrate();
  }

  // 根据类型值 震动
  static shock(ShockType type) {
    switch (type) {
      case ShockType.light:
        light();
        break;
      case ShockType.medium:
        medium();
        break;
      case ShockType.heavy:
        heavy();
        break;
      case ShockType.vibrate:
        vibrate();
        break;
    }
  }
}

// 震动类型
enum ShockType {
  light,
  medium,
  heavy,
  vibrate,
}
